import { _decorator, Component, Label, Node } from "cc";
import { GameManager } from "./GameManager";
const { ccclass, property } = _decorator;

@ccclass("ScoreUILayer")
export class ScoreUILayer extends Component {
  @property(Label)
  scoreLabel: Label = null;
  start() {
    GameManager.getInstance().node.on(
      "updateScore",
      this.onUpdateScore.bind(this)
    );
  }

  update(deltaTime: number) {}
  onUpdateScore() {
    this.scoreLabel.string = GameManager.score.toString();
  }
}
